package com.fnfn.sdk.api.common.msg;

import org.springframework.context.EnvironmentAware;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;
import org.springframework.core.env.Environment;

@Configuration
@PropertySource("classpath:message.properties")
public class MessageProperties implements EnvironmentAware {

    private static Environment env;

    @Override
    public void setEnvironment(Environment env) {
        MessageProperties.env = env;
    }

    public Environment getEnv() {
        return env;
    }

    @Bean
    public MessageProperties init() {
        return new MessageProperties();
    }

    public static String getValue(String key) {
        return env.getProperty(key);
    }
}
